import request from '@/config/axios'

// 设备采购计划明细 VO
export interface PurchaseEquipmentDetailVO {
  id: number // 采购详情ID
  planId: number // 采购计划ID
  purchasePlanNo: string // 采购计划编号
  purchaseType: string // 采购类型SERVICE/EQUIPMENT/NGINEERING/MATERIAL/DIRECT/MINOR
  category: string // 分类
  equipmentName: string // 设备名称
  unit: string // 单位
  parameterRequirements: string // 参数要求
  supplierQualification: string // 供应商资质要求
  reviewRequirements: string // 商务或技术评审点要求
  estimatedQuantity: number // 预估采购数量
  estimatedUnitPrice: number // 预估单价(元/含税)
  totalAmount: number // 合计
  remark: string // 备注
}

// 设备采购计划明细 API
export const PurchaseEquipmentDetailApi = {
  // 查询设备采购计划明细分页
  getPurchaseEquipmentDetailPage: async (params: any) => {
    return await request.get({ url: `/erp/purchase-equipment-detail/page`, params })
  },

  // 查询设备采购计划明细详情
  getPurchaseEquipmentDetail: async (id: number) => {
    return await request.get({ url: `/erp/purchase-equipment-detail/get?id=` + id })
  },

  // 新增设备采购计划明细
  createPurchaseEquipmentDetail: async (data: PurchaseEquipmentDetailVO) => {
    return await request.post({ url: `/erp/purchase-equipment-detail/create`, data })
  },

  // 修改设备采购计划明细
  updatePurchaseEquipmentDetail: async (data: PurchaseEquipmentDetailVO) => {
    return await request.put({ url: `/erp/purchase-equipment-detail/update`, data })
  },

  // 删除设备采购计划明细
  deletePurchaseEquipmentDetail: async (id: number) => {
    return await request.delete({ url: `/erp/purchase-equipment-detail/delete?id=` + id })
  },

  // 导出设备采购计划明细 Excel
  exportPurchaseEquipmentDetail: async (params) => {
    return await request.download({ url: `/erp/purchase-equipment-detail/export-excel`, params })
  },
}